import java.net.*;
import java.rmi.*;

import rmi.IGestionEmpleados;

public class RMI {

	final String ADDRESS = "127.0.0.1";
	
	IGestionEmpleados objRemoto;
	private Ventana v;

	public void setV(Ventana v) {
		this.v = v;
	}

	public void acceder() {
		String name = "//" + this.ADDRESS + "/GestionEmpleados";
		try {
			objRemoto = (IGestionEmpleados) Naming.lookup(name);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (NotBoundException e) {
			e.printStackTrace();
		}
		
	}

	public void obtener() {
		try {
			v.cargarTabla(objRemoto.getEmpleados());
		} catch (RemoteException e) {
			e.printStackTrace();
		}
	}

}
